<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<link href="${ctx}resources/css/select/bootstrap-select.css" rel="stylesheet" type="text/css">
	<%@ include file="/WEB-INF/common/head.jsp"%>
</head>
<body class="${cookie.bodyClass.value}">
<div class="container body">
	<div class="main_container">
		<%@ include file="/WEB-INF/common/left.jsp"%>
		<%@ include file="/WEB-INF/common/top.jsp"%>
		<!-- page content -->
		<div class="right_col" role="main" id="main">
			<div class="x_panel">
				<div class="x_title">
					<h2>会员详情</h2>
					<div class="clearfix"></div>
				</div>
				<div class="x_content">
					<div class="modal-body">
						<form role="form" data-parsley-validate id="orderForm" class="form-horizontal">
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">用户头像:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<a href="${imgDomain}${member.headImg}" title="点击查看原图" target="_blank">
										<img src="${imgDomain}${member.headImg}" width="100px;" height="80px;">
									</a>
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">会员昵称:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="nickName" name="nickName" value="${member.nickName}" placeholder="昵称" readonly="readonly">
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">手机号:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="cellphone" name="cellphone" value="${member.nickName}" readonly="readonly">
								</div>
							</div>
							<div class="form-group item">
								<label for="address" class="col-sm-3 control-label">性别:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="sex" name="sex" value="<c:if test="${member.sex==0}">保密</c:if><c:if test="${member.sex==1}">男</c:if><c:if test="${member.sex==2}">女</c:if>" placeholder="性别" required='required' data-parsley-length="[0,100]" readonly>
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">用户状态:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="status" name="status"
										   value="<c:if test="${member.status==0}">正常</c:if><c:if test="${member.status==1}">禁用</c:if>"
										   placeholder="状态" required='required'
										   data-parsley-length="[0,100]" readonly>
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">用户认证:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="isIdentification" name="isIdentification"
										   value="<c:if test="${member.isIdentification==0}">未认证</c:if><c:if test="${member.isIdentification==1}">已认证</c:if>" placeholder="认证"
										   required='required'
										   data-parsley-length="[0,100]" readonly>
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">会员等级:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<c:if test="${member.memberLevel==0}" >
									<input type="text" class="form-control" id="memberLevel" name="memberLevel" value="普通"  readonly>
									</c:if>
									<c:if test="${member.memberLevel==1}" >
										<input type="text" class="form-control" id="memberLevel" name="memberLevel" value="经销商"  readonly>
									</c:if>
									<c:if test="${member.memberLevel==2}" >
										<input type="text" class="form-control" id="memberLevel" name="memberLevel" value="分销商"  readonly>
									</c:if>
									<c:if test="${member.memberLevel==3}" >
										<input type="text" class="form-control" id="memberLevel" name="memberLevel" value="代理商"  readonly>
									</c:if>
									
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">推荐码:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="inviteCode" name="inviteCode" value="${member.inviteCode}" placeholder="推荐码" required='required'
										   data-parsley-length="[0,100]" readonly>
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">待返利积分:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="waitMemberRebatePoints" name="waitMemberRebatePoints" value="${member.waitMemberRebatePoints}" placeholder="待返利积分" required='required'
										   data-parsley-length="[0,100]" >
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">银积分:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="consumePoints" name="consumePoints" value="${member.consumePoints}" placeholder="银积分" required='required'
										   data-parsley-length="[0,100]" >
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">金积分:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="withdrawalsPoints" name="withdrawalsPoints" value="${member.withdrawalsPoints}" placeholder="金积分" required='required'
										   data-parsley-length="[0,100]" >
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">用户注册时间:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="registerDate" name="registerDate" value="${member.showItems.registerTime}" placeholder="注册时间" required='required'
										   data-parsley-length="[0,100]" readonly>
								</div>
							</div>
							<div class="form-group item">
								<label for="name" class="col-sm-3 control-label">最后登录时间:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="lastLoginDate" name="lastLoginDate" value="${member.showItems.lastLoginTime}" placeholder="最后登录时间" required='required'
										   data-parsley-length="[0,100]" readonly>
								</div>
							</div>
							</div>
						</form>
					</div>
					<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="text-align:center">
						<button type="button" class="btn btn-dark btn-sm" onclick="back();">返回</button>
						<button type="button" class="btn btn-dark btn-sm" onclick="moditify();">修改</button>
						<%--<c:if test="${member.status==0}">
							<button type="button" class="btn btn-primary btn-sm" onclick="disable();">禁用</button>
						</c:if>--%>
						<c:if test="${member.isIdentification==0&&indentify.id>0}">
							<button type="button" class="btn btn-primary btn-sm" onclick="confirmDeliveryModel();">认证</button>
						</c:if>
					</div>
				</div>
			</div>
		</div>
		<!-- /page content -->
		<%@ include file="/WEB-INF/common/foot.jsp"%>
	</div>
</div>
<!--审核用户start-->
<div id="memberModal" class="modal fade" tabindex="-1" role="dialog" data-backdrop="false" aria-hidden="true">
	<div class="modal-dialog modal-md">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">×</span>
				</button>
				<h4 class="modal-title" id="modelTitle">用户审核信息</h4>
			</div>
			<div class="modal-body">
				<form role="form" data-parsley-validate id="memberForm" class="form-horizontal">
					<input id="memberId" name="memberId" type="hidden" value="${member.id}" />
					<input id="indentifyId" name="indentifyId" type="hidden" value="${indentify.id}" />
					<div class="form-group item">
						<label for="fullName2" class="col-sm-3 control-label">证件照片：</label>
						<div class="col-sm-6">
							<a href="${imgDomain}${indentify.idCardImg}" title="点击查看原图" target="_blank">
								<img src="${imgDomain}${indentify.idCardImg}" id="idCardImg" width="100px;" height="100px;">
							</a>
						</div>
					</div>
					<div class="form-group item">
						<label for="username2" class="col-sm-3 control-label">证件卡号：</label>
						<div class="col-sm-6">
							<input type="text" class="form-control" readonly value="${indentify.idCardNumber}" id="idCardNumber" name="idCardNumber" placeholder="证件卡号">
						</div>
					</div>
					<div class="form-group item">
						<label for="username2" class="col-sm-3 control-label">用户名：</label>
						<div class="col-sm-6">
							<input type="text" class="form-control" readonly value="${indentify.name}" id="name" name="name" placeholder="用户名">
						</div>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" onclick="closeModal();">取消</button>
				<button type="button" class="btn btn-success" onclick="identify();">审核</button>
			</div>
		</div>
	</div>
</div>
<!--审核用户end-->
<%@ include file="/WEB-INF/common/script.jsp"%>
<script src="${ctx}resources/js/select/bootstrap-select.js"></script>
<script type="text/javascript">
    function back() {
        window.location = ctx + "admin/member/toMemberPage";
    }
    $(function() {
        $("#place-1").hide();
        var memberId = $("#memberId").val();
    });

    function closeModal() {
        $('#memberModal').modal("hide");
    }

    function confirmDeliveryModel() {
        $('#memberModal').modal("show");
        $("#memberId").val('${member.id}')
    }


    function identify() {
        swal({
            "title" : "",
            "text" : "正在处理……请稍后",
            "showConfirmButton" : false
        });
        $.ajax({
            url : ctx + "admin/member/identifyMember",
            dataType : "json",
            data : $("#memberForm").serialize(),
            success : function(result) {
                if (result.status == "0") {
                    swal({
                        title : '',
                        text : "操作成功"
                    }, function() {
                        back();
                    });
                } else {
                    swal({
                        title : '',
                        text : result.msg,
                        type : "error"
                    });
                }
            }
        });
    }


    function moditify() {
        var wp = $('#waitMemberRebatePoints').val();
        var cp = $('#consumePoints').val();
        var wdp = $('#withdrawalsPoints').val();
        var memberId = $("#memberId").val();
        swal({
            "title" : "",
            "text" : "正在处理……请稍后",
            "showConfirmButton" : false
        });
        $.ajax({
            url : ctx + "admin/member/moditifyMember",
            dataType : "json",
            data : {'memberId':memberId,'waitMemberRebatePoints':wp,'consumePoints':cp,'withdrawalsPoints':wdp},
            success : function(result) {
                if (result.status == "0") {
                    swal({
                        title : '',
                        text : "操作成功"
                    }, function() {
                        back();
                    });
                } else {
                    swal({
                        title : '',
                        text : result.msg,
                        type : "error"
                    });
                }
            }
        });
    }

</script>
</body>
</html>